﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AccountRegisterStep1 : System.Web.UI.Page
{
    protected void Page_Render(object sender, EventArgs e)
    {
        recaptcha.ErrorMessage = "sdfgsfg";
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void RegButton_Click(object sender, EventArgs e)
    {

        if (recaptcha.IsValid)
        {

            //проверка совпадения пароля и его повторения не сделана!
            Util.User man = new Util.User();
            man.Login = Login.Text;
            man.Password = Password.Text;
            man.Email = Email.Text;
            string erM = "";

            BLL.AcoolaMemberShip tmp = new BLL.AcoolaMemberShip();
            if (tmp.Registration(man, out erM))
            {
                FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, Login.Text, DateTime.Now, DateTime.Now.AddMinutes(50), false, FormsAuthentication.FormsCookiePath);
                string hash = FormsAuthentication.Encrypt(authTicket);
                HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);
                Response.Cookies.Add(cookie);
                Response.Redirect("~/Default.aspx");
            }
        }
    }
}
